package com.java.simple.study.jvm.sugar;

import java.util.Arrays;
import java.util.List;

/**
 * @author zhoujunlin
 * @date 2022/1/16
 * @desc 语法糖 for循环
 **/
public class Demo8_5 {

    public static void main(String[] args) {
        // 数组赋初值的简化写法也是语法糖  new int[]{1,2,3,4,5}
        int[] array = {1, 2, 3, 4, 5};
        for (int e : array) {
            System.out.println(e);
        }

        List<Integer> list = Arrays.asList(1, 2, 3, 4, 5);

        for (Integer i : list) {
            System.out.println(i);
        }
    }
}
